package ch5;

import java.io.*;

public class InputTest2 {

	public static void main(String[] args) throws IOException {
		// input
		InputStream fin = new FileInputStream("E:/java61/java61.txt");

		System.out.println(fin.available() + "个字节");
		byte[] b = new byte[10];// 一次最多读10个
		// 把汉字截半拉的情况
		int len = 0;
		while ((len = fin.read(b)) > -1) {
			System.out.println("本次读了" + len + "个字节");
			String s = new String(b, 0, len, "gbk");
			System.out.println(s);
		}

		fin.close();
	}

}
